package pub.developers.forum.infrastructure;

import org.springframework.stereotype.Repository;
import pub.developers.forum.common.enums.FollowedTypeEn;
import pub.developers.forum.domain.repository.UserFollowRepository;
import pub.developers.forum.infrastructure.dal.dao.UserFollowDAO;

import javax.annotation.Resource;
import java.util.List;


@Repository
public class UserFollowRepositoryImpl implements UserFollowRepository {

    @Resource
    private UserFollowDAO userFollowDAO;


    @Override
    public List<Long> getAllFollowerIds(Long follower, FollowedTypeEn type) {
        return userFollowDAO.getAllFollowerIds(follower, type.getValue());
    }

    //根据帖子id 去follow表中查询点赞记录 , 拿到给我对应帖子点赞的人的id
    @Override
    public Long[] getFollowersIds(Long id) {
        return userFollowDAO.selectFollowPostUserId(id);
    }

    @Override
    public Long getLike(Long userId, Long postId) {

        return userFollowDAO.getLike(userId,postId);

    }


}
